package cn.broadsense.common.config;

import lombok.extern.slf4j.Slf4j;
import net.sourceforge.tess4j.Tesseract;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author huangjinshi
 * @description
 * @createDate 2024-09-23 09:01:46
 */
@Slf4j
@Configuration
public class TesseractOcrConfig {

    @Bean("tesseract")
    public Tesseract tesseract() {
        log.info("初始化OCR");
        Tesseract tesseract = new Tesseract();
        // 设置训练数据文件夹路径
        tesseract.setDatapath("D:/company/Tesseract-OCR/tessdata");
        // 设置为中文简体
        tesseract.setLanguage("chi_sim");
        return tesseract;
    }

}
